home *** CD-ROM | disk | FTP | other *** search
- DefInt A-Z
- Option Explicit
- Global State%
- Global OldState%
- 'Flags for State%
- Global Const sOn = 1
- Global Const sOff = 2
- Global Const sCombine = 3
- Global CRLF$ 'Carriage Return
- 'Flags for GetClip and ClipText_Change procedures
- Global IgnoreChange%
- Global IgnoreClip%
- Global FileDirty% 'True if changes not yet saved
- Global Beeper% 'Beep after adding new item
- Global Title() As String 'Titles array
- Global Clip() As Variant 'Text array
- Global ClipCount% 'Array elements counter
- Global CombineIndex% 'Item being combined
- Global OldLi% 'Tracks previous Listindex for ClipText_Change
- 'FileName Holders
- Global cFile$
- Global tFile$
- Declare Function GetActiveWindow Lib "User" () As Integer
-
- 'clipboard monitoring functions
- 'Global OldCLipboardHandle% 'Handle of last clipboard data
- 'Declare Function GetClipboardData Lib "User" (ByVal wFormat As Integer) As Integer
- 'Global Const CF_Text = 1
- 'Global Const CF_OwnerDisplay = &H80
- 'Declare Function OpenClipboard Lib "User" (ByVal hWnd As Integer) As Integer
- 'Declare Function CloseClipboard Lib "User" () As Integer
- 'Declare Function IsClipboardFormatAvailable Lib "User" (ByVal wFormat As Integer) As Integer
-
- Function CheckClipboardStatus% ()
- ' Z = OpenClipboard(MClipForm.hWnd)
- ' Priv% = IsClipboardFormatAvailable(CF_OwnerDisplay)
- ' Select Case Priv%
- ' Case Is = 0 'easy, standard text
- ' CheckClipboardStatus% = GetClipboardData(CF_Text)
- ' Case Else 'private format
- ' CheckClipboardStatus% = -1
- ' End Select
- ' Z = CloseClipboard()
-
-
- End Function
-
- Function CheckDirty () As Integer
- If FileDirty% = True Then
- Dim C%
- C% = MsgBox("Abandon changes to this file?", 305, "Clips")
- If C% <> 1 Then CheckDirty = True: Exit Function
- End If
- CheckDirty = False
- End Function
-
- Function CleanString (Test$) As String
- Dim I%
-
- Test$ = Trim(Test$)
- 'first strip off leading control chars
- Do While Len(Test$) > 2
- If Asc(Left$(Test$, 1)) < 33 Then
- Test$ = Mid$(Test$, 2)
- Else
- Exit Do
- End If
- Loop
- 'now chop at 1st return
- I% = InStr(Test$, CRLF$)
- If I% Then Test$ = Left$(Test$, I% - 1)
- CleanString = Test$
- End Function
-
- Sub GetClip ()
- Dim B$, T$
- Static OldClipText$
- On Error GoTo MemError
- B$ = Clipboard.GetText()
- If IgnoreClip% = True Then
- IgnoreClip% = False
- OldClipText$ = B$
- Exit Sub
- End If
- If B$ = OldClipText$ Then Exit Sub
- OldClipText$ = B$
- If LTrim(B$) = "" Then Exit Sub
- ClipCount% = ClipCount% + 1
- ReDim Preserve Title(ClipCount%)
- ReDim Preserve Clip(ClipCount%)
- T$ = CleanString(Left$(B$, 60))
- mClipForm.Titles.AddItem T$
- mClipForm.Titles.ListIndex = mClipForm.Titles.NewIndex
- Title(ClipCount% - 1) = T$
- T$ = ""
- mClipForm.ClipText = B$
- B$ = ""
- ToggleMenu True
- If Beeper% Then Beep
- BackDoor1:
- Exit Sub
- MemError:
- If Err = 14 Then MsgBox "Clipboard text is too long!"
- Clipboard.SetText ""
- Resume BackDoor1
- End Sub
-
- Sub LabelIt ()
- If State% = sOn Then
- mClipForm.Label1 = "State=ON":
- Else
- mClipForm.Label1 = "State=OFF"
- End If
- End Sub
-
- Sub NoEdit ()
- mClipForm.ClipText.SelStart = Len(mClipForm.Titles)
- mClipForm.ClipText.SelLength = 0
- End Sub
-
- Sub SaveCurrFile ()
- LibSave
- End Sub
-
- Sub SaveWithNewName ()
- mClipForm.CMDialog1.DefaultExt = "MCF"
- mClipForm.CMDialog1.Filter = "Clips files|*.MCF"
- On Error Resume Next
- mClipForm.CMDialog1.Action = 2
- If Err = 32755 Then Exit Sub
- tFile$ = mClipForm.CMDialog1.Filename
- If tFile$ = "" Then Exit Sub
- cFile$ = Left$(tFile$, InStr(tFile$, ".")) + "CLP"
-
- Dim X
- For X = Len(tFile$) To 1 Step -1
- If Mid$(tFile$, X) = "\" Then
- Path$ = Left$(tFile$, X)
- Exit For
- End If
- Next
- LibSave
-
- 'MClipForm.CMDialog1.Filename
- 'MsgBox MClipForm.CMDialog1.Filename
- End Sub
-
- Sub SetCombineMode ()
- Select Case State% = sCombine
- Case Is = False
- IgnoreChange% = True
- OldState% = State%
- State% = sCombine%
- mClipForm.Label1 = "State is Combine"
- CombineIndex% = mClipForm.Titles.ListIndex
- mClipForm.ClipText.SetFocus
- Case Is = True
- State% = OldState%
- LabelIt
- mClipForm.Titles.ListIndex = CombineIndex%
- IgnoreChange% = False
- End Select
- End Sub
-
- Sub ToggleMenu (e As Integer)
- Dim X
- For X = 0 To 7
- If X <> 5 Then mClipForm.eItem(X).Enabled = e
- Next
- mClipForm.fItem(3).Enabled = e
- mClipForm.fItem(4).Enabled = e
-
- End Sub
-
- Sub ToggleSettings (CheckMe%)
- Dim X
- For X = 1 To 3
- If X = CheckMe% Then
- mClipForm.sItem(X).Checked = True
- Else
- mClipForm.sItem(X).Checked = False
- End If
- Next
- End Sub
-
- Sub YesEdit ()
- IgnoreClip% = True
- OldLi% = mClipForm.Titles.ListIndex
- End Sub
-
-